@extends('admin::layouts.master')
@section('content')
    <div class="modal-header">
        <h3 id="ModalLabel">{{ $title or '' }}</h3>
    </div>
    <div class="modal-body">
        <!-- check for login error flash var -->
        @if (Session::has('flash_error'))
        <div id="flash_error">{{ Session::get('error') }}</div>
        @endif
        {{ Form::model($user, array('url' => $packageAdmin.'/admin/user/store', 'method' => 'post', 'role' => 'form' , 'class' => 'form-horizontal'))}}
            <!-- Email field -->
            <div class="form-group">
                {{ Form::label('email', 'Email', array('class' => 'col-sm-2 control-label')) }}
                <div class="col-sm-5">
                        @if (!$user->id)
                            {{ Form::text('email', Input::old('email'), array('placeholder' => 'someone@awesome.com', 'class' => 'form-control  input-lg')) }}
                        @else
                            {{ Form::text('email', Input::old('email'), array('placeholder' => 'someone@awesome.com', 'class' => 'form-control  input-lg', 'disabled' => 'disabled')) }}
                        @endif
                    <ul class="flash_error">
                        @foreach($errors->get('email') as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                    </ul>
                </div>
            </div>

            <!-- password field -->
            @if (!$user->id)
            <div class="form-group">
                {{ Form::label('password', 'Password', array('class' => 'col-sm-2 control-label')) }}
                <div class="col-sm-5">
                    {{ Form::text('password', Input::old('password') ,array('class' => 'form-control  input-lg')) }}
                    <ul class="flash_error">
                        @foreach($errors->get('password') as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                    </ul>
                </div>
            </div>
            @endif
            <!-- firstname field -->
            <div class="form-group">
                {{ Form::label('first_name', 'First name', array('class' => 'col-sm-2 control-label')) }}
                <div class="col-sm-5">
                    {{ Form::text('first_name', Input::old('first_name'),array('class' => 'form-control  input-lg')) }}
                    <ul class="flash_error">
                        @foreach($errors->get('first_name') as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                    </ul>
                </div>
            </div>
            <!-- lastname field -->
            <div class="form-group">
                {{ Form::label('last_name', 'Last name', array('class' => 'col-sm-2 control-label')) }}
                <div class="col-sm-5">
                    {{ Form::text('last_name', Input::old('last_name'), array('class' => 'form-control  input-lg')) }}
                    <ul class="flash_error">
                        @foreach($errors->get('last_name') as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                    </ul>
                </div>
            </div>
            <!-- submit button -->
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-5 right">
                    {{ Form::hidden('id') }}
                    {{ Form::submit( $user->id ? 'Update': 'Create', array('class' => 'btn btn-primary')) }}
                </div>
            </div>
        {{ Form::close() }}
    </div>
    <div class="modal-footer"></div>
    @stop